﻿using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.CommonFilter;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel;
using Kingdee.BOS.Core.Metadata.EntityElement;
using Kingdee.BOS.Core.Metadata.FieldElement;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.JSON;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;

namespace WSDZ.KM.ZH.OtherReceivableGotoReport1
{
    [Description("其他应收单跳转应收款明细"), HotUpdate]
    public class OtherReceivableGotoReport : AbstractDynamicFormPlugIn
    {
        public override void ButtonClick(ButtonClickEventArgs e)
        {
            base.ButtonClick(e);
            //应收明细表查询
            if (e.Key.EqualsV1("F_RLKX_Buttonysmx"))
            {
                try
                {
                    //获取往来单位
                    string custType = Model.GetValue("FCONTACTUNITTYPE").ToStringV1();
                    int custId = 0;
                    DynamicObject custObj = Model.GetValue("FCONTACTUNIT") as DynamicObject;
                    if (custObj!=null)
                        custId = custObj["Id"].ToStringV1().ToInt32V1();
                    if (custType.IsNullOrEmptyOrWhiteSpace()||custId==0)
                        return;
                    string pageId = Guid.NewGuid().ToString();
                    //MoveReportShowParameter showParameter = new MoveReportShowParameter();
                    SysReportShowParameter showParameter = new SysReportShowParameter();
                    showParameter.CustomComplexParams.Add("custType", custType);
                    showParameter.CustomComplexParams.Add("custId", custId);
                    showParameter.FormId = "AR_PAYDETAILREPORT";
                    showParameter.PageId = pageId;
                    showParameter.OpenStyle.ShowType = ShowType.Modal;
                    this.View.ShowForm(showParameter);
                }
                catch (Exception ex)
                {
                    View.ShowErrMessage(ex.Message);
                }
            }
           
        }
    }

}
